package encapsulator;

import java.lang.reflect.Method;

import exceptions.InvalidParameterException;

import blackPeter.ClassY;

public class Demo {

	public static void main(String[] args) {

		MethodEncapsulator me = new MethodEncapsulator();
		ClassY y = new ClassY();
		@SuppressWarnings("rawtypes")
		Class c = y.getClass();
		Method[] methods = c.getMethods();
		Method m = methods[3];
//		System.out.println(m);
		try {
			me.addMethod(m, y);
		} catch (InvalidParameterException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
		try {
			me.executeMethod(0);
		} catch (InvalidParameterException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			me.remove(0);
		} catch (InvalidParameterException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			me.executeMethod(0);
		} catch (InvalidParameterException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}
